define( [
  'require',
  'jquery',
  'constants'
], function( require, $, c ) {
  'use strict';
  var exportParam = {};

  var _czc = window._czc || [];

  var splitStr = exportParam.splitStr = '|';
  var trackEvent = '_trackEvent';

  var action = {
    action: {
      read: '文章阅读',
      like: '文章点赞',
      unlike: '文章取消点赞',
      collect: '文章收藏',

      tpcRead: '话题阅读',
      click: '点击',
    }
  };

  $.extend( exportParam, {

    clickstr: splitStr + action.action.read + splitStr,
    likestr: splitStr + action.action.like + splitStr,
    unlikestr: splitStr + action.action.unlike + splitStr,

    artcle: '文章详情',
    weekread: '周阅读榜',
    weeklike: '周点赞榜',
    searchArt: '文章搜索',
    searchImg: '图片搜索',
    searchTpc: '话题搜索',
    searchGzh: '账号搜索',
    allArt: '全部文章',
    _10WPlus: '10W+文章',
    guessArt: '猜你喜欢',
    topicComparison: '话题加入对比',

  }, action );


  _czc.push( [ '_setAccount', '1261116262' ] );

  // CNZZ 事件统计
  $( document ).on( 'click', '[data-cnzz-trackevent]', function() {
    var cnzzTrackevent = $( this ).data( 'cnzzTrackevent' );
    var pushData = cnzzTrackevent.split( splitStr );

    if ( pushData[ 2 ] === undefined ) {
      pushData[ 2 ] = c.userLoginBehavior;
    }
    pushData.unshift( '_trackEvent' );
    pushData.length >= 4 && _czc.push( pushData );
  } ).on( 'click', '[data-cnzz-setcustomvar]', function() {

  } );

  function doDataPush( param ) {
    var pushData = [ trackEvent ];
    if ( param[ 'label' ] === undefined ) {
      param[ 'label' ] = c.userLoginBehavior;
    }
    // cnzz统计参数列表，顺序固定
    [ 'category', 'action', 'label', 'value', 'nodeid' ].forEach( function( item ) {
      pushData.push( param[ item ] );
    } );

    return pushData;
  }

  /* 添加一条统计数据到cnzz */
  exportParam.addRecord = function( param ) {
    param = param || {};
    _czc.push( doDataPush( param ) );
  }

  return exportParam;
} );
